package com.example.daytest.depend;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Random;

/**
 * @author heyu
 * @title: Test
 * @description:
 * @date 2022/2/16下午3:17
 */
@Configuration
@ComponentScan
public class Test {

    public static void main(String[] args) {

        String dateTimeString = "2023-02-20 12:00:00";
        DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse(dateTimeString, inputFormatter);
        DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd H:mm:ss");
        String outputString = dateTime.format(outputFormatter);
        System.out.println(outputString);


        Date date=new Date();
        System.out.printf("2位数字12时制的小时（前面不补0）:%tl%n",date);



//        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
//        context.register(Test.class);
//        //刷新容器上下文，触发单例bean创建
//        context.refresh();
//        //关闭上下文
//        context.close();



//
//        int tem=0;
//        int[] arr={9,1,2,8,6,3,5,7};
//        for (int i=0;i< arr.length-1;i++)
//            for (int j=0;j<arr.length-i-1;j++){
//               if(arr[j]>arr[j+1]){
//                   tem=arr[j];
//                   arr[j]=arr[j+1];
//                   arr[j+1]=tem;
//               }
//            }
//        System.out.println(arr);


//                // 声明一个记录头奖的数组
//                int[] firstPrize = new int[6];
//                // 声明一个随机数发生器
//                Random random = new Random();
//                // 设置头奖号码
//                for (int i=0; i<firstPrize.length; i++) {
//                    firstPrize[i] = random.nextInt(35)+1;
//                }
//                System.out.println("大乐透今天的开奖号码是:");
//                for (int j=0; j<firstPrize.length; j++) {
//                    System.out.print(firstPrize[j]+"  ");
//                }
//                System.out.println("\n恭喜中奖者！");




    }


}
